<script src="{{ getAssets }}js/amazeui.datatables.min.js?v={{ assets_version }}"></script>
<script src="{{ getAssets }}lodop/LodopFuncs.js?v={{ assets_version }}"></script>
<script>
    var opt_id = 0;
	var tables = $('#dataTables').DataTable({
		"sAjaxSource" : '{{ urlfor "OptometryController.DataGrid"}}'
		,"bLengthChange": false
		,"fnServerData" : function(sSource, aoData, fnCallback) {
			var params = checkQueryTableData(aoData)
			$('#search_key').val() ? params.Filter = $('#search_key').val() : '';
            if($('#dateline').val()) {
                var dateline = $('#dateline').val();
                var time = Date.parse(dateline);
                params.StartDate = time / 1000;
                params.EndDate = params.StartDate + 60000;
            }
			$.post(sSource, JSON.stringify(params),function(resp) {
				fnCallback(resp);
			},'json')
		}
		,columns: [
            {"bSortable": false, render:function(data, type, full, meta) {
                    return full.Archives.Number;
            }}
			,{"bSortable": false, render:function(data, type, full, meta) {
				return full.Archives.Realname;
			}}
			,{"mDataProp" : "Optometrist", "bSortable": false}
			,{"mDataProp": "CreatedAt", render:function(data, type, full, meta) {
				return timetrans(data);
			}}
		]
        ,"aLengthMenu":[100]
		,'bLengthChange': false
		,"serverSide": true
		,"bPaginate" : false
		,"bFilter" : false	//是否启动过滤、搜索功能 
		,"bInfo" : false //是否显示页脚信息，DataTables插件左下角显示记录数
		,"bProcessing" : true //DataTables载入数据时，是否显示‘进度’提示
	});
	
	$("#searchsubmit").bind("click", function () { //点击按钮 触发table重新请求服务器
		$("#dataTables").dataTable().fnDraw(false);
	});

    $(window).keydown(function (event) {
        if(event.keyCode==13){
            var value = $('#search_key').val();
            if(value != '') {
                $("#searchsubmit").click();
            }
        }
    });
    $('#dataTables tbody').on( 'click','tr',function(){
        var data = tables.row(this).data();
        getOptometry(data.Id);
        opt_id = data.Id;
        $('#dataTables tbody').find('tr').removeClass('am-active');
        $(this).addClass('am-active');
    } );
    function getOptometry(opt_id) {
        $('#opt-detail').html('');
        $.post('{{ urlfor "OptometryController.View" }}?opt_id='+opt_id, function (res) {
            if(res.code == 1) {
                layer.alert(res.msg,function () {
                    history.back();
                });
                return false;
            }
            opt = res.data;
            $('#user').text(opt.Archives.Realname+' 【'+ opt.Archives.Mobile +'】');
            $('#document_number').text(opt.DocumentNumber);
            $('#doctor').text(opt.Doctor);
            $('#optometrist').text(opt.Optometrist);
            $('#created_time').text(timetrans(opt.CreatedAt));
            $('#remarks').text(opt.Remarks);

            var record = {};
            record.id = opt.Id;
            record.optometry_snd_id = record.id;

            var chufang = opt.chufang;
            if(chufang == null) {
                layer.alert("没有找到处方信息");return false;
            }

            if(chufang['far']) {
                record.far = {};
                record.far.right = chufang['far']['right'];
                record.far.left = chufang['far']['left'];
                record.far.tongju_yuan = record.far.left.total_pd_yuan;
            }

            if(chufang['near']) {
                record.near = {};
                record.near.right = chufang['near']['right'];
                record.near.left = chufang['near']['left'];
                record.near.tongju_jin = record.near.left.total_pd_jin;
            }
            if(chufang['yinxing']) {
                record.yinxing = {};
                record.yinxing.right = chufang['yinxing']['right'];
                record.yinxing.left = chufang['yinxing']['left'];
            }
            if(chufang['duojiaodian']) {
                record.duojiaodian = {};
                record.duojiaodian.right = chufang['duojiaodian']['right'];
                record.duojiaodian.left = chufang['duojiaodian']['left'];
                record.duojiaodian.tongju_yuan = record.duojiaodian.right.total_pd_yuan;
                record.duojiaodian.tongju_jin = record.duojiaodian.right.total_pd_jin;
            }
            var html = show_detail(record);
            $('#opt-detail').html(html);

        }, 'json');
    }
    function show_detail(record) {
        var html=[];
        var id = "'"+record.id+"'";
        var chufang_type;
        var optometry_snd_id;
        html.push('<div class="ms">');
        if(record.near){
            chufang_type= "'near'";
            optometry_snd_id="'"+record.near.optometry_snd_id+"'";
            html.push('<div class="chufang">');
            html.push('<div class="title am-cf">');
            html.push('<h3>近用处方</h3>');
            html.push('</div>');
            html.push('<div class="datatable-shili" data-type="near" >');
            html.push('<div class="info-bar list-head am-cf">');
            html.push('<div class="item" style="width:11%">球镜</div>');
            html.push('<div class="item" style="width:11%">柱镜</div>');
            html.push('<div class="item" style="width:11%">轴位</div>');
            html.push('<div class="item" style="width:11%">瞳距(mm)</div>');
            html.push('<div class="item" style="width:11%">瞳高(mm)</div>');
            html.push('<div class="item" style="width:11%">裸眼视力</div>');
            html.push('<div class="item" style="width:11%">矫正视力</div>');
            html.push('<div class="item" style="width:11%">棱镜</div>');
            html.push('<div class="item" style="width:11%">基底</div>');
            html.push('</div>');
            html.push('<div class="info-bar blue-bg am-cf" data-type="right">');
            html.push(record.near.right.sph?'<div class="item" data-type="sph" style="width:11%">'+record.near.right.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.near.right.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.near.right.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.near.right.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.near.right.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.near.right.pd_jin?'<div class="item" data-type="pd_jin" style="width:11%">'+record.near.right.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.near.right.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.near.right.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.near.right.nv?'<div class="item" data-type="nv" style="width:11%">'+record.near.right.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.near.right.cv?'<div class="item" data-type="cv" style="width:11%">'+record.near.right.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.near.right.v?'<div class="item" data-type="v" style="width:11%">'+record.near.right.v+'</div>':'<div class="item" data-type="v" style="width:11%"></div>');
            html.push(record.near.right.bc?'<div class="item" data-type="bc" style="width:11%">'+record.near.right.bc+'</div>':'<div class="item" data-type="bc" style="width:11%"></div>');
            html.push('<span class="type blue">右眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar red-bg am-cf" data-type="left">');
            html.push(record.near.left.sph?'<div class="item" data-type="sph" style="width:11%">'+record.near.left.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.near.left.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.near.left.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.near.left.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.near.left.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.near.left.pd_jin?'<div class="item" data-type="pd_jin" style="width:11%">'+record.near.left.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.near.left.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.near.left.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.near.left.nv?'<div class="item" data-type="nv" style="width:11%">'+record.near.left.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.near.left.cv?'<div class="item" data-type="cv" style="width:11%">'+record.near.left.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.near.left.v?'<div class="item" data-type="v" style="width:11%">'+record.near.left.v+'</div>':'<div class="item" data-type="v" style="width:11%"></div>');
            html.push(record.near.left.bc?'<div class="item" data-type="bc" style="width:11%">'+record.near.left.bc+'</div>':'<div class="item" data-type="bc" style="width:11%"></div>');
            html.push('<span class="type red">左眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar define-row col4 am-cf">');
            html.push('<div class="item"><div class="pmr" data-type="total_pd_jin"><span>总近用瞳距:</span><b>'+record.near.tongju_jin+'</b>mm</div></div>');
            html.push('</div>');
            html.push('</div>');
            html.push('</div>');
        }
        if(record.far){
            chufang_type= "'far'";
            optometry_snd_id="'"+record.far.optometry_snd_id+"'";
            html.push('<div class="chufang">');
            html.push('<div class="title am-cf">');
            html.push('<h3>远用处方</h3>');
            html.push('</div>');
            html.push('<div class="datatable-shili" data-type="far" >');
            html.push('<div class="info-bar list-head am-cf">');
            html.push('<div class="item" style="width:11%">球镜</div>');
            html.push('<div class="item" style="width:11%">柱镜</div>');
            html.push('<div class="item" style="width:11%">轴位</div>');
            html.push('<div class="item" style="width:11%">瞳距(mm)</div>');
            html.push('<div class="item" style="width:11%">瞳高(mm)</div>');
            html.push('<div class="item" style="width:11%">裸眼视力</div>');
            html.push('<div class="item" style="width:11%">矫正视力</div>');
            html.push('<div class="item" style="width:11%">棱镜</div>');
            html.push('<div class="item" style="width:11%">基底</div>');
            html.push('</div>');
            html.push('<div class="info-bar blue-bg am-cf" data-type="right">');
            html.push(record.far.right.sph?'<div class="item" data-type="sph" style="width:11%">'+record.far.right.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.far.right.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.far.right.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.far.right.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.far.right.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.far.right.pd_yuan?'<div class="item" data-type="pd_jin" style="width:11%">'+record.far.right.pd_yuan+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.far.right.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.far.right.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.far.right.nv?'<div class="item" data-type="nv" style="width:11%">'+record.far.right.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.far.right.cv?'<div class="item" data-type="cv" style="width:11%">'+record.far.right.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.far.right.v?'<div class="item" data-type="v" style="width:11%">'+record.far.right.v+'</div>':'<div class="item" data-type="v" style="width:11%"></div>');
            html.push(record.far.right.bc?'<div class="item" data-type="bc" style="width:11%">'+record.far.right.bc+'</div>':'<div class="item" data-type="bc" style="width:11%"></div>');
            html.push('<span class="type blue">右眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar red-bg am-cf" data-type="left">');
            html.push(record.far.left.sph?'<div class="item" data-type="sph" style="width:11%">'+record.far.left.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.far.left.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.far.left.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.far.left.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.far.left.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.far.left.pd_yuan?'<div class="item" data-type="pd_jin" style="width:11%">'+record.far.left.pd_yuan+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.far.left.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.far.left.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.far.left.nv?'<div class="item" data-type="nv" style="width:11%">'+record.far.left.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.far.left.cv?'<div class="item" data-type="cv" style="width:11%">'+record.far.left.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.far.left.v?'<div class="item" data-type="v" style="width:11%">'+record.far.left.v+'</div>':'<div class="item" data-type="v" style="width:11%"></div>');
            html.push(record.far.left.bc?'<div class="item" data-type="bc" style="width:11%">'+record.far.left.bc+'</div>':'<div class="item" data-type="bc" style="width:11%"></div>');
            html.push('<span class="type red">左眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar define-row col4 am-cf">');
            html.push('<div class="item"><div class="pmr" data-type="total_pd_yuan"><span>总远用瞳距:</span><b>'+record.far.tongju_yuan+'</b>mm</div></div>');
            html.push('</div>');
            html.push('</div>');
            html.push('</div>');
        }
        if(record.yinxing){
            chufang_type= "'yinxing'";
            optometry_snd_id="'"+record.yinxing.optometry_snd_id+"'";
            html.push('<div class="chufang">');
            html.push('<div class="title am-cf">');
            html.push('<h3>隐形处方</h3>');
            html.push('</div>');
            html.push('<div class="datatable-shili" data-type="yinxing" >');
            html.push('<div class="info-bar list-head am-cf">');
            html.push('<div class="item" style="width:11%">球镜</div>');
            html.push('<div class="item" style="width:11%">柱镜</div>');
            html.push('<div class="item" style="width:11%">轴位</div>');
            html.push('<div class="item" style="width:11%">瞳距(mm)</div>');
            html.push('<div class="item" style="width:11%">瞳高(mm)</div>');
            html.push('<div class="item" style="width:11%">裸眼视力</div>');
            html.push('<div class="item" style="width:11%">矫正视力</div>');
            html.push('<div class="item" style="width:11%">直径</div>');
            html.push('<div class="item" style="width:11%">基弧</div>');
            html.push('</div>');
            html.push('<div class="info-bar blue-bg am-cf" data-type="right">');
            html.push(record.yinxing.right.sph?'<div class="item" data-type="sph" style="width:11%">'+record.yinxing.right.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.yinxing.right.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.yinxing.right.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.yinxing.right.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.yinxing.right.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.yinxing.right.pd_jin?'<div class="item" data-type="pd_jin" style="width:11%">'+record.yinxing.right.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.yinxing.right.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.yinxing.right.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.yinxing.right.nv?'<div class="item" data-type="nv" style="width:11%">'+record.yinxing.right.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.yinxing.right.cv?'<div class="item" data-type="cv" style="width:11%">'+record.yinxing.right.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.yinxing.right.diameter?'<div class="item" data-type="diameter" style="width:11%">'+record.yinxing.right.diameter+'</div>':'<div class="item" data-type="diameter" style="width:11%"></div>');
            html.push(record.yinxing.right.base_curve?'<div class="item" data-type="base_curve" style="width:11%">'+record.yinxing.right.base_curve+'</div>':'<div class="item" data-type="base_curve" style="width:11%"></div>');
            html.push('<span class="type blue">右眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar red-bg am-cf" data-type="left">');
            html.push(record.yinxing.left.sph?'<div class="item" data-type="sph" style="width:11%">'+record.yinxing.left.sph+'</div>':'<div class="item" data-type="sph" style="width:11%"></div>');
            html.push(record.yinxing.left.cyl?'<div class="item" data-type="cyl" style="width:11%">'+record.yinxing.left.cyl+'</div>':'<div class="item" data-type="cyl" style="width:11%"></div>');
            html.push(record.yinxing.left.axial_view?'<div class="item" data-type="axial_view" style="width:11%">'+record.yinxing.left.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:11%"></div>');
            html.push(record.yinxing.left.pd_jin?'<div class="item" data-type="pd_jin" style="width:11%">'+record.yinxing.left.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:11%"></div>');
            html.push(record.yinxing.left.mrp?'<div class="item" data-type="mrp" style="width:11%">'+record.yinxing.left.mrp+'</div>':'<div class="item" data-type="mrp" style="width:11%"></div>');
            html.push(record.yinxing.left.nv?'<div class="item" data-type="nv" style="width:11%">'+record.yinxing.left.nv+'</div>':'<div class="item" data-type="nv" style="width:11%"></div>');
            html.push(record.yinxing.left.cv?'<div class="item" data-type="cv" style="width:11%">'+record.yinxing.left.cv+'</div>':'<div class="item" data-type="cv" style="width:11%"></div>');
            html.push(record.yinxing.left.diameter?'<div class="item" data-type="diameter" style="width:11%">'+record.yinxing.left.diameter+'</div>':'<div class="item" data-type="diameter" style="width:11%"></div>');
            html.push(record.yinxing.left.base_curve?'<div class="item" data-type="bc" style="width:11%">'+record.yinxing.left.base_curve+'</div>':'<div class="item" data-type="base_curve" style="width:11%"></div>');
            html.push('<span class="type red">左眼</span>');
            html.push('</div>');
            html.push('</div>');
            html.push('</div>');
        }
        if(record.duojiaodian){
            chufang_type= "'duojiaodian'";
            optometry_snd_id="'"+record.duojiaodian.optometry_snd_id+"'";
            html.push('<div class="chufang">');
            html.push('<div class="title am-cf">');
            html.push('<h3>多焦点处方</h3>');
            html.push('</div>');
            html.push('<div class="datatable-shili" data-type="duojiaodian" >');
            html.push('<div class="info-bar list-head am-cf">');
            html.push('<div class="item" style="width:8.3%">球镜</div>');
            html.push('<div class="item" style="width:8.3%">柱镜</div>');
            html.push('<div class="item" style="width:8.3%">轴位</div>');
            html.push('<div class="item" style="width:8.3%">近瞳距(mm)</div>');
            html.push('<div class="item" style="width:8.3%">远瞳距(mm)</div>');
            html.push('<div class="item" style="width:8.3%">瞳高(mm)</div>');
            html.push('<div class="item" style="width:8.3%">裸眼视力</div>');
            html.push('<div class="item" style="width:8.3%">矫正视力</div>');
            html.push('<div class="item" style="width:8.3%">ADD</div>');
            html.push('<div class="item" style="width:8.3%">通道</div>');
            html.push('<div class="item" style="width:8.3%">棱镜</div>');
            html.push('<div class="item" style="width:8.3%">基底</div>');
            html.push('</div>');
            html.push('<div class="info-bar blue-bg am-cf" data-type="right">');
            html.push(record.duojiaodian.right.sph?'<div class="item" data-type="sph" style="width:8.3%">'+record.duojiaodian.right.sph+'</div>':'<div class="item" data-type="sph" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.cyl?'<div class="item" data-type="cyl" style="width:8.3%">'+record.duojiaodian.right.cyl+'</div>':'<div class="item" data-type="cyl" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.axial_view?'<div class="item" data-type="axial_view" style="width:8.3%">'+record.duojiaodian.right.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.pd_jin?'<div class="item" data-type="pd_jin" style="width:8.3%">'+record.duojiaodian.right.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.pd_yuan?'<div class="item" data-type="pd_yuan" style="width:8.3%">'+record.duojiaodian.right.pd_yuan+'</div>':'<div class="item" data-type="pd_yuan" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.mrp?'<div class="item" data-type="mrp" style="width:8.3%">'+record.duojiaodian.right.mrp+'</div>':'<div class="item" data-type="mrp" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.nv?'<div class="item" data-type="nv" style="width:8.3%">'+record.duojiaodian.right.nv+'</div>':'<div class="item" data-type="nv" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.cv?'<div class="item" data-type="cv" style="width:8.3%">'+record.duojiaodian.right.cv+'</div>':'<div class="item" data-type="cv" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.add_info?'<div class="item" data-type="add_info" style="width:8.3%">'+record.duojiaodian.right.add_info+'</div>':'<div class="item" data-type="add_info" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.pass?'<div class="item" data-type="pass" style="width:8.3%">'+record.duojiaodian.right.pass+'</div>':'<div class="item" data-type="pass" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.v?'<div class="item" data-type="v" style="width:8.3%">'+record.duojiaodian.right.v+'</div>':'<div class="item" data-type="v" style="width:8.3%"></div>');
            html.push(record.duojiaodian.right.bc?'<div class="item" data-type="bc" style="width:8.3%">'+record.duojiaodian.right.bc+'</div>':'<div class="item" data-type="bc" style="width:8.3%"></div>');
            html.push('<span class="type blue">右眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar red-bg am-cf" data-type="left">');
            html.push(record.duojiaodian.left.sph?'<div class="item" data-type="sph" style="width:8.3%">'+record.duojiaodian.left.sph+'</div>':'<div class="item" data-type="sph" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.cyl?'<div class="item" data-type="cyl" style="width:8.3%">'+record.duojiaodian.left.cyl+'</div>':'<div class="item" data-type="cyl" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.axial_view?'<div class="item" data-type="axial_view" style="width:8.3%">'+record.duojiaodian.left.axial_view+'</div>':'<div class="item" data-type="axial_view" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.pd_jin?'<div class="item" data-type="pd_jin" style="width:8.3%">'+record.duojiaodian.left.pd_jin+'</div>':'<div class="item" data-type="pd_jin" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.pd_yuan?'<div class="item" data-type="pd_yuan" style="width:8.3%">'+record.duojiaodian.left.pd_yuan+'</div>':'<div class="item" data-type="pd_yuan" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.mrp?'<div class="item" data-type="mrp" style="width:8.3%">'+record.duojiaodian.left.mrp+'</div>':'<div class="item" data-type="mrp" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.nv?'<div class="item" data-type="nv" style="width:8.3%">'+record.duojiaodian.left.nv+'</div>':'<div class="item" data-type="nv" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.cv?'<div class="item" data-type="cv" style="width:8.3%">'+record.duojiaodian.left.cv+'</div>':'<div class="item" data-type="cv" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.add_info?'<div class="item" data-type="add_info" style="width:8.3%">'+record.duojiaodian.left.add_info+'</div>':'<div class="item" data-type="add_info" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.pass?'<div class="item" data-type="pass" style="width:8.3%">'+record.duojiaodian.left.pass+'</div>':'<div class="item" data-type="pass" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.v?'<div class="item" data-type="v" style="width:8.3%">'+record.duojiaodian.left.v+'</div>':'<div class="item" data-type="v" style="width:8.3%"></div>');
            html.push(record.duojiaodian.left.bc?'<div class="item" data-type="bc" style="width:8.3%">'+record.duojiaodian.left.bc+'</div>':'<div class="item" data-type="bc" style="width:8.3%"></div>');
            html.push('<span class="type red">左眼</span>');
            html.push('</div>');
            html.push('<div class="info-bar define-row col4 am-cf">');
            html.push('<div class="item"><div class="pmr" data-type="total_pd_jin"><span>总近用瞳距:</span><b>'+record.duojiaodian.tongju_jin+'</b>mm</div></div>');
            html.push('<div class="item"><div class="pmr" data-type="total_pd_yuan"><span>总远用瞳距:</span><b>'+record.duojiaodian.tongju_yuan+'</b>mm</div></div>');
            html.push('</div>');
            html.push('</div>');
            html.push('</div>');
        }
        html.push('</div>');
        html.push('</div>');
        return html.join("");
    }
    function optometryPrinter() {
        if(opt_id == 0) {
            layer.alert('请选择需要打印的处方单');return false;
        }
        $.post('{{urlfor "OptometryController.ViewOne"}}/'+opt_id, function(json){
            if(json.code == 0){
                if(json.data.chufang == null) {
                    layer.alert("没有找到处方信息");return false;
                }
                createOptometryPrinter(json.data);
            } else {
                layer.msg(json.msg);
            }
        }, 'json');
    }
    function slimscroll() {
        var height = $(window).height();
        $('#dataTables_box').slimscroll({
            height: (height-260)+'px',
            width: '100%', //可滚动区域宽度
            size:"10px",
            color:'#0e90d2',
            railVisible: false, //是否 显示轨道
            alwaysVisible: true,
        });
    }
    $(window).resize(function(){
        slimscroll();
    });
    slimscroll();

</script>